<?xml version="1.0"?>
<OnTheFlyInstruction xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <InstanceId>Metaweblog 1</InstanceId>
  <Tags>
    <string>Metaweblog</string>
  </Tags>
  <AdditionalAssemblies />
  <Code><![CDATA[// 	Sample Metaweblog api with MetaWeblogSharp
// 	http://metaweblogsharp.codeplex.com/
// 	v 1.0 - 2013-07-02 rec 0
using xSolon.Instructions;
using System;using xSolon.Instructions.DTO;
using System.Data;using System.Linq;
using MetaWeblogSharp;

public class MetaWeblogSharpSample1 : AbstractInstruction
{
	
	public override void Run()
	{
		var con1 = new MetaWeblogSharp.BlogConnectionInfo(
                "http://localhost",
                "http://localhost/metaweblog.axd",
                "blogId", // You might not know the id, we'll get it on next line.
                "admin",
                "password");
                
		var client = new MetaWeblogSharp.Client(con1);
		
		// Get a list of all available blogs
		var blogs = client.GetUsersBlogs();
		
		// Send it to the 'Data Table' tab, if you need to see it
		// ResultTable = blogs.GetSerializedList().ListToTable();
		
		// Use the first blog
		var blog = blogs.First();
		
		NotifyInformation("Id:{0} Name:{1}", blog.BlogID, blog.BlogName);
		
		// API needs to the id of the blog
		client.BlogConnectionInfo.BlogID = blog.BlogID;
		
        // create a new post
        //string postid = client.NewPost("P1", "P1Content", 
        //	"Category 1;Category2".Split(';'), false, DateTime.Now);
        	
        //NotifyInformation("New Post ID: {0}", postid);
        
        // update post
        //client.EditPost(postid,"new title","new description",null,false);
        
        var posts = client.GetRecentPosts(10);
        
        ResultTable = posts.GetSerializedList().ListToTable();
	}
}]]></Code>
</OnTheFlyInstruction>